﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/BackendMain.master"
    AutoEventWireup="true" CodeFile="ServiceList.aspx.cs" Inherits="Backend_Service" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table>
        <tr>
            <td>Service:
                <asp:TextBox ID="txtService" runat="server"></asp:TextBox>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
                    onclick="btnSubmit_Click" />
            </td>
        </tr>
        <tr>
            <td>
                Service List:
            </td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                    DataKeyNames="Id" DataSourceID="SqlDataSource1" AllowPaging="True">
                    <Columns>
                        <asp:CommandField ShowEditButton="True" />
                        <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" Visible="false" SortExpression="Id" />
                        <asp:BoundField DataField="ServiceName" HeaderText="ServiceName" SortExpression="ServiceName" />
                        <asp:BoundField DataField="CreateTime" HeaderText="CreateTime" SortExpression="CreateTime" />
                        <asp:BoundField DataField="UpdateTime" HeaderText="UpdateTime" SortExpression="UpdateTime" />
                        <asp:CheckBoxField DataField="IsDeleted" HeaderText="IsDeleted" SortExpression="IsDeleted" />
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
    </table>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EmployeeTrackingConnectionString %>"
        DeleteCommand="DELETE FROM [EtServiceInfo] WHERE [Id] = @Id" InsertCommand="INSERT INTO [EtServiceInfo] ([Id], [ServiceName], [CreateTime], [UpdateTime], [IsDeleted]) VALUES (@Id, @ServiceName, @CreateTime, @UpdateTime, @IsDeleted)"
        SelectCommand="SELECT * FROM [EtServiceInfo]" UpdateCommand="UPDATE [EtServiceInfo] SET [ServiceName] = @ServiceName, [CreateTime] = @CreateTime, [UpdateTime] = @UpdateTime, [IsDeleted] = @IsDeleted WHERE [Id] = @Id">
        <DeleteParameters>
            <asp:Parameter Name="Id" Type="Object" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Id" Type="Object" />
            <asp:Parameter Name="ServiceName" Type="String" />
            <asp:Parameter Name="CreateTime" Type="DateTime" />
            <asp:Parameter Name="UpdateTime" Type="DateTime" />
            <asp:Parameter Name="IsDeleted" Type="Boolean" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="ServiceName" Type="String" />
            <asp:Parameter Name="CreateTime" Type="DateTime" />
            <asp:Parameter Name="UpdateTime" Type="DateTime" />
            <asp:Parameter Name="IsDeleted" Type="Boolean" />
            <asp:Parameter Name="Id" Type="Object" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
